package com.example.app2;

import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;

import androidx.annotation.RequiresPermission;
import androidx.appcompat.app.AppCompatActivity;

import com.example.app2.Template.StandardReceiver;

public class BroadcastActivity1 extends AppCompatActivity implements View.OnClickListener {

    private Button button1;
    private StandardReceiver standardReceiver;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_broadcast1);

        button1 = findViewById(R.id.button1);

        button1.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {


       // View view = LayoutInflater.from(this).inflate(R.layout.dialog_layout, null);
        AlertDialog.Builder builder = new AlertDialog.Builder(this);

       // builder.setView(view);

        builder.setTitle("尊敬的用户");
        builder.setMessage("是否进行强制下线");
        builder.setPositiveButton("确定", (dialog, which) -> {

            standardReceiver = new StandardReceiver();
            //返回原来的登录界面
            if (StandardReceiver.i == 1) {
                Log.d("xxf", "onClick: 按钮页面 "+StandardReceiver.i);
                Intent intent = new Intent(getApplicationContext(), BroadcastActivity.class);
                startActivity(intent);



            }
        });

        builder.setNegativeButton("取消", (dialog, which) -> {


        });

        //创建对话框
        AlertDialog alertDialog = builder.create();

        //显示对话框
        alertDialog.show();

    }
}